﻿
@model RTW.OA.Models.official_document_borrow
@{

    Layout = "~/Views/Shared/_LayoutBase.cshtml";
}

@section styles{

}
<div id="dMain">
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="ibox" style="margin-bottom: 0px;">
            <div class="ibox-title">
                <h4>文件借阅批示 </h4>
            </div>
            <div class="ibox-content">
                @using (Html.BeginForm("Approval", "Borrow", FormMethod.Post, new { area = "Document", id = "form", name = "form" }))
                {
                    @Html.AntiForgeryToken()

                <div class="from-content">
                    <dl>
                        <dt>公文标题</dt>
                        <dd>
                            @Html.TextBoxFor(m => m.official_document.SUBJECT, new { @class = "input normal form-control" ,@readonly="readonly"})
                        </dd>
                    </dl>
                    <dl>
                        <dt>申请人</dt>
                        <dd>
                            @Html.TextBoxFor(m => m.PROPOSER_USER_NAME, new { @class = "input normal form-control", @readonly = "readonly" })
                        </dd>
                    </dl>
                    <dl>
                        <dt>申请时间</dt>
                        <dd>
                            @Html.TextBoxFor(m => m.CREATE_TIME, new { @class = "input normal form-control", @readonly = "readonly" })
                        </dd>
                    </dl>
                    <dl>
                        <dt>借阅天数</dt>
                        <dd>
                            @Html.TextBoxFor(m => m.DAYS, new { @class = "input normal form-control", @readonly = "readonly" })
                        </dd>
                    </dl>
                    <dl>
                        <dt>借阅理由</dt>
                        <dd>
                            @Html.TextAreaFor(m => m.REASON, new { @class = "input normal form-control", @readonly = "readonly" })
                        </dd>
                    </dl>
                    <dl>
                        <dt>审批备注</dt>
                        <dd>
                            @Html.TextAreaFor(m => m.APPROVAL_REMARK, new { @class = "input normal form-control" })
                        </dd>
                    </dl>
                    @Html.HiddenFor(m => m.BORROW_ID)
                </div>
                    <div class="from-footer">
                        <div class="btn-wrap" style="position: fixed;">
                            <a class="btn btn-sm btn-primary radius" onclick="approval(1)">
                                <i class="iconfont icon-save"></i>
                                批示通过
                            </a>
                            <a class="btn btn-sm btn-warning radius" onclick="approval(0)">
                                <i class="iconfont icon-fanhui"></i>
                                批示不通过
                            </a>
                        </div>
                    </div>
                }
            </div>
        </div>
    </div>
</div>
@section scripts{
    <script src="@Url.Content("~/Content/JS/common/WdatePicker/WdatePicker.js")"></script>
    <script type="text/javascript" charset="utf-8" src="@Url.Content("~/Content/JS/common/jquery/Validform_v5.3.2_min.js")"></script>
    <script type="text/javascript" charset="utf-8" src="@Url.Content("~/Content/JS/common/artdialog/dialog-plus-min.js")"></script>
    <script type="text/javascript" charset="utf-8" src="@Url.Content("~/Content/JS/common/webuploader/webuploader.min.js")"></script>
    <script type="text/javascript" charset="utf-8" src="@Url.Content("~/Content/editor/ueditor.config.js")"></script>
    <script type="text/javascript" charset="utf-8" src="@Url.Content("~/Content/editor/ueditor.all.min.js")"></script>
    <script type="text/javascript" charset="utf-8" src="@Url.Content("~/Content/editor/lang/zh-cn/zh-cn.js")"></script>

    <script type="text/javascript" charset="utf-8" src="@Url.Content("~/Content/JS/common/uploader.js")"></script>
    @*<script type="text/javascript" charset="utf-8" src="../js/uploader.js"></script>*@

    <script src="@Url.Content("~/Content/JS/common/from.js")"></script>

    <script src="@Url.Content("~/Content/js/common/signalR/jquery.signalR-2.4.0.min.js")"></script>
    <script src="@Url.Content("~/signalr/hubs")"></script>
    <script src="@Url.Content("~/Content/js/common/signalR/signalRContext.js")"></script>
    <script>
        $(function () {
            //初始化表单验证
            $("#form").initValidform();
        });

        function savefrom() {
            $("#form").submit();
        }

        function approval(status) {
            var docId = $("#BORROW_ID").val();
            var remark = $("#APPROVAL_REMARK").val();
            if (remark == "" || remark.length < 1) {
                alert("请输入审批备注");
                return false;
            }
            if (status == 0) {
                $.post("/Document/Borrow/SetApproval", {
                    id: docId,
                    remark: remark,
                    status: 1
                    },
                    function (result) {
                        //sendMessage("Model.DRAFT_USER_NO", "official_document", "公文批示通知", "/document/send/index", null);
                        layer.msg('设置成功！', {
                            icon: 1,
                            time: 2000//2s后自动关闭
                        }, function () {
                            parent.layer.close(parent.layer.index);
                        });

                });

            } else {
                layer.confirm('是否确认批示通过？', {
                    btn: ['确定', '取消'] //按钮
                }, function () {
                    $.post("/Document/Borrow/SetApproval", {
                        id: docId,
                        status: 2,
                        remark: remark
                    }, function (result) {
                        $("#approval-modal").modal("hide");
                        //sendMessage("Model.DRAFT_USER_NO", "official_document", "公文批示通知", "/document/send/index", null);
                        layer.msg('设置成功！', {
                            icon: 1,
                            time: 2000//2s后自动关闭
                        }, function () {
                            parent.layer.close(parent.layer.index);
                        });
                    });
                }, function () {

                });
            }
        }
    </script>

}